//---------------------------------------------------------------------------
//
// GaussDB SPQ Optimizer
//
//    Copyright (C) 2021, HuaWei Group Holding Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//    @filename:
//        CXformIndexGet2ShareIndexScan.h
//
//    @doc:
//        Transform Index Get to Index Scan
//---------------------------------------------------------------------------
#ifndef SPQOPT_CXformIndexGet2ShareIndexScan_H
#define SPQOPT_CXformIndexGet2ShareIndexScan_H

#include "spqos/base.h"

#include "spqopt/xforms/CXformImplementation.h"

namespace spqopt
{
using namespace spqos;

//---------------------------------------------------------------------------
//    @class:
//        CXformIndexGet2ShareIndexScan
//
//    @doc:
//        Transform Index Get to Index Scan
//
//---------------------------------------------------------------------------
class CXformIndexGet2ShareIndexScan : public CXformImplementation
{
private:
public:
    CXformIndexGet2ShareIndexScan(const CXformIndexGet2ShareIndexScan &) = delete;

    // ctor
    explicit CXformIndexGet2ShareIndexScan(CMemoryPool *);

    // dtor
    ~CXformIndexGet2ShareIndexScan() override = default;

    // ident accessors
    EXformId
    Exfid() const override
    {
        return ExfIndexGet2ShareIndexScan;
    }

    // xform name
    const CHAR *
    SzId() const override
    {
        return "CXformIndexGet2ShareIndexScan";
    }

    // compute xform promise for a given expression handle
    EXformPromise Exfp(CExpressionHandle &    //exprhdl
    ) const override;

    // actual transform
    void Transform(CXformContext *pxfctxt, CXformResult *pxfres,
                   CExpression *pexpr) const override;

};    // class CXformIndexGet2ShareIndexScan

}  // namespace spqopt

#endif    // !SPQOPT_CXformIndexGet2ShareIndexScan_H

// EOF
